# 对HTML动手脚

import re

with open('..\\..\\..\\lessons\\htmlsample.html', 'r', encoding='UTF-8') as orifile:
    lines = orifile.readlines()
    newlines = []
    for line in lines:
        newlines.append(re.sub('<[^<>]*>', '', line)) 
        # 这里匹配的尖括号内不能有尖括号, 否则因为regex的贪心特性会全部识别

with open('htmlsample_new.txt','w') as newfile:
    newfile.writelines(newlines)